<?php

class dbaPaymentTrans
{

    var $dba;

    function dbaPaymentTrans (&$dba)
    {
        $this->dba = &$dba;
    }
    
    function add($m_id, $lang_id, $descr)
    {
        $this->dba->query("insert into ".$this->dba->tableforwarder."_shopPaymentDescr" .
                " (m_id, lang_id, descr) values ($m_id, $lang_id, '$descr')");
    }
    
    function del($m_id, $lang_id)
    {
        $this->dba->query("delete from ".$this->dba->tableforwarder."_shopPaymentDescr" .
                " where m_id=$m_id and lang_id=$lang_id");
    }
    
    function getall()
    {
        $sth = $this->dba->query("select M.id as m_id, D.lang_id, M.descr as mode,L.name as lang, " .
                "D.descr as descr from ".$this->dba->tableforwarder."_shopPaymentDescr D," .
                $this->dba->tableforwarder."_shopPaymentMode M, ".
                $this->dba->tableforwarder."_cmsLang L where D.m_id=M.id " .
                "and D.lang_id=L.id");
        if (is_object($sth))
        {
            return $sth->fetch_rows_array();
        }
    }

    function get($m_id, $l_id)
    {
        $sth = $this->dba->query("select M.descr as mode,L.name as lang, " .
                "D.descr as descr from ".$this->dba->tableforwarder."_shopPaymentDescr D," .
                $this->dba->tableforwarder."_shopPaymentMode M, ".
                $this->dba->tableforwarder."_cmsLang L where D.m_id=M.id " .
                "and D.lang_id=L.id and D.m_id=$m_id and D.lang_id=$l_id");
        if (is_object($sth))
        {
            return $sth->fetch_row_array();
        }
    }

}

?>